package com.chan.mediacamera;

public class VolidateMain {

    public static void main(String[] args) {
        VolidateMain main = new VolidateMain();
        VolidateClass volidateClass = main.new VolidateClass();
    }

    public class VolidateClass {

        private volatile int i = 0;

        public VolidateClass() {
            VolidateThread thread = new VolidateThread();
            VolidateThread2 thread2 = new VolidateThread2();
            VolidateThread3 thread3 = new VolidateThread3();
            thread.start();
            thread2.start();
            thread3.start();
        }

        class VolidateThread extends Thread {
            @Override
            public void run() {
                while (i < 10) {
                    System.out.println("VolidateThread: " + i);
                    i++;

                }
                System.out.println("VolidateThread end : " + i);
            }
        }

        class VolidateThread2 extends Thread {
            @Override
            public void run() {
                while (i < 10) {
                    System.out.println("VolidateThread2: " + i);
                    i++;

                }
                System.out.println("VolidateThread2 end : " + i);
            }
        }

        class VolidateThread3 extends Thread {
            @Override
            public void run() {
                while (i < 10) {
                    System.out.println("VolidateThread3: " + i);
                    i++;

                }
                System.out.println("VolidateThread3 end : " + i);
            }
        }
    }


}
